import request from '@/utils/request'

// 购物车查询
export function customerCarList(query) {
  return request({
    url: `/app_api/customer-car/list/${query.sellChannel}`,
    method: 'get'
  })
}
// 购物车删除
export function customerCarDelete(query) {
  return request({
    url: `/app_api/customer-car/delete/${query.id}`,
    method: 'get'
  })
}

// 购物车数量修改
export function customerCarCount(query) {
	switch(query.type) {
		case 'plus':
			return request({
			  url: `/app_api/customer-car/add-one/${query.id}/${query.sellChannel}`,
			  method: 'get'
			})
			break;
		case 'minus':
			return request({
			  url: `/app_api/customer-car/reduce-one/${query.id}/${query.sellChannel}`,
			  method: 'get'
			})
			break;
		default: 
			return request({
			  url: '/app_api/customer-car/update',
			  method: 'post',
			  data: query
			})
	}
}
// 添加购物车
export function customerCarAdd(data) {
  return request({
    url: '/app_api/customer-car/add',
    method: 'post',
    data: data
  })
}
// 修改购物车
export function customerCarUpdate(data) {
  return request({
    url: '/app_api/customer-car/update',
    method: 'post',
    data: data
  })
}


